package com.alone.mybatisplus.datascope.annotation;


import com.alone.mybatisplus.datascope.conts.DataScopeModel;
import org.apache.ibatis.mapping.MappedStatement;
import org.springframework.core.annotation.AliasFor;

import java.lang.annotation.*;

/**
 * 参数与DataScope类对照<p/>
 * 标记在mapper方法时，优先级低于通过参数传递的DataScope<p/>
 * 标记在mapper类上时，优先级低于mapper方法
 * @see com.alone.mybatisplus.datascope.core.DataScopeExtractor#findDataScope(Object, MappedStatement)
 *
 * @author Alone
 */
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
public @interface Scope {

    boolean allowAll() default false;

    String sql() default "";

    @AliasFor("model")
    DataScopeModel value() default DataScopeModel.EMPTY;

    @AliasFor("value")
    DataScopeModel model() default DataScopeModel.EMPTY;

}
